import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Employee {
    private String name;
    private int age;
    private String gender;
    private String position;
    private double salary;
    private String id; // 工号

    public Employee(String name, int age, String gender, String position, double salary, String id) {
        this.name = name;
        this.age = age;
        this.gender = gender;
        this.position = position;
        this.salary = salary;
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public String getGender() {
        return gender;
    }

    public String getPosition() {
        return position;
    }

    public double getSalary() {
        return salary;
    }

    public String getId() {
        return id;
    }

    @Override
    public String toString() {
        return "Employee{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", gender='" + gender + '\'' +
                ", position='" + position + '\'' +
                ", salary=" + salary +
                ", id='" + id + '\'' +
                '}';
    }
}

class Company {
    private String companyName;
    private String registeredAddress;
    private String phone;
    private String businessScope;
    private List<Employee> employees;

    public Company(String companyName, String registeredAddress, String phone, String businessScope) {
        this.companyName = companyName;
        this.registeredAddress = registeredAddress;
        this.phone = phone;
        this.businessScope = businessScope;
        this.employees = new ArrayList<>();
    }

    public void hireEmployee(Employee employee) {
        if (!employees.stream().anyMatch(e -> e.getId().equals(employee.getId()))) {
            employees.add(employee);
            System.out.println("员工 " + employee.getName() + " 已成功入职！");
        } else {
            System.out.println("工号重复，入职失败！");
        }
    }

    public void fireEmployee(String id) {
        employees.removeIf(e -> e.getId().equals(id));
        System.out.println("工号为 " + id + " 的员工已被辞退。");
    }

    public void printEmployeeInfo() {
        for (Employee employee : employees) {
            System.out.println(employee);
        }
    }

    public int countEmployees() {
        return employees.size();
    }

    public Employee getHighestPaidEmployee() {
        return employees.stream().max((e1, e2) -> Double.compare(e1.getSalary(), e2.getSalary())).orElse(null);
    }
}

public class test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Company company = new Company("Moonshot AI", "Moonshot Street", "123456789", "AI Technology");

        boolean running = true;
        while (running) {
            System.out.println("\n请选择操作：");
            System.out.println("1. 新人入职");
            System.out.println("2. 开除员工");
            System.out.println("3. 输出员工信息");
            System.out.println("4. 统计公司人数");
            System.out.println("5. 获取薪水最高的员工");
            System.out.println("6. 退出");
            System.out.print("请输入选项：");
            int choice = scanner.nextInt();
            scanner.nextLine(); // 消费换行符

            switch (choice) {
                case 1:
                    System.out.print("请输入员工姓名：");
                    String name = scanner.nextLine();
                    System.out.print("请输入员工年龄：");
                    int age = scanner.nextInt();
                    scanner.nextLine();
                    System.out.print("请输入员工性别：");
                    String gender = scanner.nextLine();
                    System.out.print("请输入员工职务：");
                    String position = scanner.nextLine();
                    System.out.print("请输入员工薪水：");
                    double salary = scanner.nextDouble();
                    scanner.nextLine();
                    System.out.print("请输入员工工号：");
                    String id = scanner.nextLine();
                    Employee employee = new Employee(name, age, gender, position, salary, id);
                    company.hireEmployee(employee);
                    break;
                case 2:
                    System.out.print("请输入要辞退的员工工号：");
                    String fireId = scanner.nextLine();
                    company.fireEmployee(fireId);
                    break;
                case 3:
                    company.printEmployeeInfo();
                    break;
                case 4:
                    System.out.println("公司当前员工人数：" + company.countEmployees());
                    break;
                case 5:
                    Employee highestPaid = company.getHighestPaidEmployee();
                    if (highestPaid != null) {
                        System.out.println("薪水最高的员工是：" + highestPaid);
                    } else {
                        System.out.println("公司没有员工。");
                    }
                    break;
                case 6:
                    running = false;
                    System.out.println("程序已退出。");
                    break;
                default:
                    System.out.println("无效选项，请重新选择。");
                    break;
            }
        }
        scanner.close();
    }
}